#ifndef __TEST_CSBUF_H__
#define __TEST_CSBUF_H__
// 本文件由自动工具 proto.py 自动生成，请勿修改
// filename test_csbuf.h
// package test

#include "CsbufParser.h"
#include "CsbufMessage.h"
#include "test1_csbuf.h"

namespace test {

// message Test
class Test: public CsbufMessage
{
public:
	uint8_t t1;
	uint32_t t_2;
	std::string t3_;
	std::vector<uint32_t> t4;

	Test()
	: CsbufMessage(1001)
	{
		t1 = 0;
		t_2 = 0;
		t3_ = "";
	}

	void Marshal(CsbufParser& writer)
	{
		writer.setUint8(t1, 1);
		writer.setUint32(t_2, 2);
		writer.setString(t3_, 3);
		uint8_t countt4 = (uint8_t)t4.size();
		writer.setArray(countt4, 4);
		for (uint8_t i=0; i<countt4; ++i)
		{
			writer.setUint32(t4[i], 0);
		}
	}

	void Unmarshal(CsbufParser& reader)
	{
		t1 = reader.getUint8(1);
		t_2 = reader.getUint32(2);
		t3_ = reader.getString(3);
		uint8_t countt4 = reader.getArray(4);
		for (uint8_t i=0; i<countt4; ++i)
		{
			t4.push_back(reader.getUint32(0));
		}
	}
};
// message t2
class t2: public CsbufMessage
{
public:
	uint8_t t1;
	int16_t t3;

	t2()
	: CsbufMessage(1002)
	{
		t1 = 0;
		t3 = 0;
	}

	void Marshal(CsbufParser& writer)
	{
		writer.setUint8(t1, 1);
		writer.setInt16(t3, 2);
	}

	void Unmarshal(CsbufParser& reader)
	{
		t1 = reader.getUint8(1);
		t3 = reader.getInt16(2);
	}
};
}
#endif
